package com.cs.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cs.domain.ProdComm;
import com.cs.service.ProdCommService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/prod/prodComm")
@Api(tags = "评论管理的接口")
public class ProdCommController {
    @Autowired
    private ProdCommService prodCommService;

    /**
     * 分页查询评论的接口
     * @param page
     * @param prodComm
     * @return
     */
    @GetMapping("/page")
    @ApiOperation(value = "分页查询评论的接口")
    @PreAuthorize("hasAuthority('prod:prodComm:page')")
    public ResponseEntity<Page<ProdComm>> findProdCommPage(Page<ProdComm> page,ProdComm prodComm){
        Page<ProdComm> prodCommPage=prodCommService.findProdCommPage(page,prodComm);
        return ResponseEntity.ok(prodCommPage);
    }
}
